"""
@author: dqx Connor
@contact: dqxconnor@163.com
@time: 2022/9/5 21:48
@file: dataLoad.py
@desc:
"""

from scipy.io import loadmat
import numpy as np

# 将加载的实验数据转化为模型的训练数据，前面的为训练，后面的为结果
def train_data_process(data):
    n, m = data.shape
    return data[:, 0:m - 1], (data[:, m - 1] > 0).astype(int)

# 从文件中加载实验数据
def load_data(filepath, data_name):
    data = loadmat(filepath)[data_name]
    temp = int(len(data) * 0.7)
    return data[0:temp, :], data[temp:-1, :]



def test_data_process(data):
    n, m = data.shape
    return data[:, 0:m-1], (data[:, m-1] > 0).astype(int)
